<!-- Home中t1组件 -->
<template>
  <div id="test1">
    <p class="left"><slot name="left"></slot></p>
    <p class="center" @click="pfzi"><slot name="center"></slot></p>
    <p class="right" @click="pf"><slot name="right"></slot></p>
  </div>
</template>

<script>
  export default {
    name: 'test1',
    data() {
      return {
        msg:'test1的值',
        t2msg:'t2组件图片加载完毕'
      }
    },
    props:{
      pop:{
          type:Array,
          default(){
            return '没传值时的默认值'
          }
        }
    },
    created(){
    },
    mounted() {
      this.pfzi();
      // console.log(this.pop[0].name);
    },
    methods: {
      //发射事件到父组件
      pf(){
        this.$emit('zipf',this.msg);
      },
      //发射事件给子组件
      pfzi(){
        this.$bus.$emit('fszi',this.t2msg);
      }

    }
  }
</script>

<style lang="scss" scoped>
  #test1{
    width: 100%;
    display: inline-block;
    .left,.center,.right{
      width: 33.3%;
      float: left;
    }
  }
  .left{
    background-color: skyblue;
  }
  .right{
    background-color: #00F8FF;
  }
  .center{
    background-color: #9effe9;
  }
</style>
